package com.bauer.java.spring.bean;

import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: weirui
 * @create: 2019-11-26 17:42
 **/
@Component
public class ComponentTest {

    private static Integer age;

    @Value("${config.age}")
    public void setAge(Integer age) {
        ComponentTest.age = age;
    }

    public static int getAge(){
        return age;
    }

    @PostConstruct
    public void init(){
        System.out.println(ComponentTest.getAge());
    }

}
